#ifndef DETECTIONTAB_H
#define DETECTIONTAB_H

#include <QtGui/QWidget>
#include <QStringList>
#include <QMessageBox>
#include <iostream>
#include "projectopener.h"
#include "imageloader.h"

using namespace std;

namespace Ui {
    class DetectionTab;
}

class DetectionTab : public QWidget {
    Q_OBJECT
public:
    DetectionTab(QWidget *parent = 0);
    ~DetectionTab();
    void populate(const QString &fileName);
    void showContent();
    void drawHistogram();
    bool saveImage(const QString &file);
    bool isProjOpened();
    QString getCurrImg();          // Get current image displayed
    QVector<QString> getFiles();   // Return files for current project
    ImageLoader *getLoader() { return this->imgL; }

protected:
    void changeEvent(QEvent *e);

private slots:
    void updatePDN(QString family);
    void updateTime(QString pdn);
    void updateByTime(QString time);

private:

    void updateChild(const QStringList& filter, int type);
    void reload();

    Ui::DetectionTab *m_ui;
    ProjectOpener *pOpener;
    QPointer<ImageLoader> imgL;
    QString curr;                   // Current image file name
};

#endif // DETECTIONTAB_H
